﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _12_泛型委托_Func
{
    internal class Program
    {
        static void Main(string[] args)
        {
            #region 无参有返回值

            Func<string> func = ()=> "当前时间:" + DateTime.Now;
            Console.WriteLine(func());

            #endregion

            #region 有参有返回值-1

            Func<string,string> funStr  = t => "当前时间:" + DateTime.Now.ToString() + " " + t;
            Console.WriteLine(funStr("调用有参有返回值的方法"));

            #endregion

            #region 有参有返回值-2

            Func<string, string, int> MathAdd = (leftValue, rightValue) => Convert.ToInt32(leftValue) + Convert.ToInt32(rightValue);
            Console.WriteLine(MathAdd("10", "20"));

            #endregion


            Console.Read();
        }
    }
}
